package com.grablist.feihu.grablist.ui.actviity.user.presenter;

import java.util.List;

import javax.inject.Inject;

import com.grablist.feihu.grablist.base.BaseBiz;
import com.grablist.feihu.grablist.bean.BillInfo;
import com.grablist.feihu.grablist.comm.MyApplication;
import com.grablist.feihu.grablist.ui.actviity.user.biz.BillBiz;
import com.grablist.feihu.grablist.ui.actviity.user.contract.BillContract;

/**
 * Created by Administrator on 2017/10/21.
 */

public class BillPresenter implements BillContract.Presenter {

    BillContract.View view;
    BillBiz billBiz;


    @Inject
    public BillPresenter(BillContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        billBiz = (BillBiz) biz;
    }

    @Override
    public void getBillList() {
        view.loading(true);
        billBiz.getbill(MyApplication.userInfo.getUserCode(), new BaseBiz.Callback<List<BillInfo>>() {
            @Override
            public void onSuccess(List<BillInfo> o) {
                view.updateBill(o);
                view.loading(false);
            }

            @Override
            public void onFailure(List<BillInfo> o) {
                view.loading(false);
            }
        });
    }
}
